package com.example.redis.demos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类描述
 *
 * @author Mr.Wu
 * @create 2019-12-02
 */
@RestController
public class IndexController {

	@Autowired
	private RedisService redisService;

	@RequestMapping("/setString")
	public String setString(String key, String value){
		redisService.set(key, value, 5000L); //超时时间5000s   l表示long型
		return "成功";
	}

	@RequestMapping("get")
	public String get(String key){
		return redisService.getString(key);
	}
}
